<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String ctx = request.getContextPath();
    request.setAttribute("ctx", ctx);
%>
<html>
<head>
    <title>Title</title>
    <script src="${ctx}/bootstrap/jquery-1.9.1.min.js"></script>
    <script src="${ctx}/bootstrap/bootstrap.js"></script>
    <script src="${ctx}/bootstrap/jquery.validate.min.js"></script>
    <script src="${ctx}/bootstrap/messages_zh.js"></script>
    <script src="${ctx}/bootstrap/validate.js"></script>
    <link rel="stylesheet" href="css/index_work.css">
</head>
<body>
<form >
    账号：<input type="text" name="name" onchange="aa()"><br>
    密码：<input type="text" name="pawass" onchange="bb()"><br>
    <input type="submit" value="提交" onclick="ff()">
</form>
<script>
function aa() {
   var a= $("[name='name']").val()
    if(a!=null){

    }else{
        alert("不能为空")
    }
}
    function ff(){
        $.post("${ctx}/logins.do",$("form").serialize(),function (data) {
            if(data){
                alert("登录成功")
                window.location.href="${ctx}/tolist.do";
            }else{
                alert("登录失败")
            }
        })
    }

</script>
</body>
</html>
